package com.yz.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Controller
public class PageController {

    // 一层路径
    @GetMapping("/{page}.html") // index.html,abc.html
    public String page1(@PathVariable String page) {
        System.out.println("page = " + page);
        return page; // 返回的视图名称/templates/index.html
    }

    // 二层路径
    @GetMapping("/{model}/{page}.html")
    public String page2(@PathVariable String model, @PathVariable String page) {
        System.out.println("model = " + model + ", page = " + page);
        return model + "/" + page; // "/templates/"+system+"/"+index +".html"
    }

    @GetMapping("/{model}/{path}/{page}.html")
    public String page3(@PathVariable String model, @PathVariable String path, @PathVariable String page) {
        System.out.println("model = " + model + ", path = " + path + ", page = " + page);
        return model + "/" + path + "/" + page; // "/templates/"+system+"/"+"/site/"+index +".html"
    }
}
